<?php 
$v_worktype_code = "";
if(isset($_REQUEST["hdn_worktype_code"]))
{
	$v_worktype_code = $_REQUEST["hdn_worktype_code"];
}
/*$v_worktype_spec = "";
if(isset($_REQUEST["txt_worktype_spec"]))
{
	$v_worktype_spec = $_REQUEST["txt_worktype_spec"];
}*/
$v_current_status_start = "";
if(isset($_REQUEST["txt_current_status_start"]))
{
	$v_current_status_start = $_REQUEST["txt_current_status_start"];
}
$v_detail_status_start = "";
if(isset($_REQUEST["txt_detail_status_start"]))
{
	$v_detail_status_start = $_REQUEST["txt_detail_status_start"];
}
$v_result_tac_vu_spec = "";
if(isset($_REQUEST["hdn_spec_task_list"]))
{
	$v_result_tac_vu_spec = $_REQUEST["hdn_spec_task_list"];
}

$v_result_kind_update = "";
if(isset($_REQUEST["sel_result_kind_update"]))
{
	$v_result_kind_update = $_REQUEST["sel_result_kind_update"];
}
$v_current_status_end = "";
if(isset($_REQUEST["txt_current_status_end"]))
{
	$v_current_status_end = $_REQUEST["txt_current_status_end"];
}
$v_detail_status_end = "";
if(isset($_REQUEST["txt_detail_status_end"]))
{
	$v_detail_status_end = $_REQUEST["txt_detail_status_end"];
}
$v_can_return = "";
if(isset($_REQUEST["hdn_chk_can_return"]))
{
	$v_can_return = $_REQUEST["hdn_chk_can_return"];
}
$v_recordtype_id_list = "";
if(isset($_REQUEST["hdn_recordtype_id_list"]))
{
	$v_recordtype_id_list = $_REQUEST["hdn_recordtype_id_list"];
}
$v_old_worktype_spec_id = "";
if(isset($_REQUEST["hdn_old_worktype_spec"]))
{
	$v_old_worktype_spec_id = $_REQUEST["hdn_old_worktype_spec"];
}

//Lay danh sach id cua can bo duoc cap nhat tien do khi giai quyet mot loai ho so
$v_staff_id_list = "";
if(isset($_REQUEST['hdn_staff_id_list'])){
	$v_staff_id_list = trim($_REQUEST['hdn_staff_id_list']);
}	

// Kiem tra xem nguoi dang nhap hien thoi co quyen cap nhat hay khong?
if(!_check_permission_on_function($_SESSION['staff_id'], $_ISA_APP_CODE, _CONST_ONEGATE_WORKTYPE_UPDATE)){?>
	<script>
		alert("<? echo _CONST_FUNCTION_PERMISSION_ERROR; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<? echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?
}

if(_is_sqlserver()){

	$sql = "Exec Onegate_Insertworktype_spec ";
	$sql = $sql . "'".$v_worktype_code."'";
	$sql = $sql . ",'".$v_current_status_start."'";
	$sql = $sql . ",'".$v_detail_status_start."'" ;
	$sql = $sql . ",'".$v_result_tac_vu_spec."'";
	$sql = $sql . ",'".$v_result_kind_update."'";
	$sql = $sql . ",'".$v_current_status_end."'";
	$sql = $sql . ",'".$v_detail_status_end."'";
	$sql = $sql . ",'".$v_can_return."'";
	$sql = $sql . ",'".$v_recordtype_id_list."'";
	$sql = $sql . ",'".$v_old_worktype_spec_id."'";
	#echo $sql; exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$rs = $ado_conn->GetRow($sql); 
	$v_error = _replace_bad_char(trim($rs['RET_ERROR']));
}

if (!is_null($v_error) and $v_error<>""){?>
	<script>
		alert("<?php echo $v_error; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<?php echo $v_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?php
	exit;
}
sleep(0);
?>
<form action="index.php" method="post" name="f_back">
	<input type="hidden" name="fuseaction" value="DISPLAY_ALL_WORKTYPE_SPEC">
	<input type="hidden" name="hdn_item_id" value="<?php echo $v_old_worktype_id;?>">
	<input type="hidden" name="hdn_filter" value="<?php echo $v_filter; ?>">
</form>
<Script language="javascript">
//	return_value = "<?php echo $v_worktype_id; ?>" + _LIST_DELIMITOR + "<?php echo $v_filter; ?>"  
//	goto_after_update_data(0, "DISPLAY_SINGLE_WORKTYPE_SPEC",return_value);
	document.forms(0).submit();
</Script>
